// 设置主页逻辑
const app = getApp();

Page({
  data: {
    userInfo: null,
    loading: false
  },

  onLoad() {
    console.log('设置页面加载');
    this.loadUserInfo();
  },

  onShow() {
    this.loadUserInfo();
  },

  /**
   * 加载用户信息
   */
  loadUserInfo() {
    const userInfo = wx.getStorageSync('userInfo');
    this.setData({ userInfo });
  },

  /**
   * 导航到个人信息设置
   */
  navigateToProfile() {
    wx.navigateTo({
      url: '/pages/settings/profile'
    });
  },

  /**
   * 导航到安全设置
   */
  navigateToSecurity() {
    wx.navigateTo({
      url: '/pages/settings/security'
    });
  },

  /**
   * 导航到通知设置
   */
  navigateToNotifications() {
    wx.navigateTo({
      url: '/pages/notification/settings/settings'
    });
  },

  /**
   * 导航到隐私设置
   */
  navigateToPrivacy() {
    wx.navigateTo({
      url: '/pages/settings/privacy'
    });
  },

  /**
   * 返回个人中心
   */
  navigateBack() {
    wx.navigateBack();
  }
});
